package day1;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-12-08
 * Time: 12:24
 */
//https://www.nowcoder.com/questionTerminal/6736cc3ffd1444a4a0057dee89be789b?orderByHotValue=1&page=1&onlyReference=false
public class TeamSuspension {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //输入几个队伍 每个队伍3个人
        int n = scanner.nextInt();
        //nextLine 不能用数组来接受
        int[] arr = new int[3*n];

        for (int i = 0; i <3*n ; i++) {
            arr[i] = scanner.nextInt();
            //读取字符到数组中
        }
        //先将数组排序
        Arrays.sort(arr);

        int num = 0;
        //然后分组 获取最大值 这里i的范围是组数
        for (int i = 0; i < n; i++) {
            num += arr[arr.length-(2*i+2)];
        }
        System.out.println(num);
    }
}
